<meta title="微信机器人测试"/>
<div class="p">
    <input autocomplete="off" type="button" value="测试" s-click="test()"/>
    <input autocomplete="off" type="button" value="获取联系人" s-click="getContact()"/>
    <img src="" id="qrCodeImg"/>
    <div class="panel panel-orange">
        <div class="panel-heading">
            <h3 class="panel-title">联系人</h3>
        </div>
        <div class="panel-body">
            <p>选择联系人进行下一步操作</p>
        </div>
        <ul class="list-group" id="contactList" s="nda,loop">
            <li class="list-group-item" s="tpl" s-loop-role="row">
                <img style="max-width: 50px; border-radius: 100%; margin-right: 20px;" src="/api/weixin-bot/avatar/{%=this.username%}" />
                <span name="username">{%=this.nickname%}</span>
            </li>
        </ul>
    </div>
</div>
<script type="text/javascript">

    function test() {
        S.get("/api/weixin-bot/login/qrcode").done(function (rs) {
            $qrCodeImg.node.attr("src", rs.qrcode);
        })
    }

    function getContact() {
        S.get("/api/weixin-bot/contact").done(function (rs) {
            $contactList.data(rs.memberList)
        })
    }

</script>